extends CardState

var played: bool

func enter() -> void:
	played = false
	
	if not card_ui.targets.is_empty():
		played = true
		var player_handler:PlayerHandler = get_tree().get_first_node_in_group("playerHandler")
		card_ui.play()
		player_handler.cur_mana = player_handler.cur_mana - card_ui.card.cost
		player_handler.player_mana_changed.emit(player_handler.cur_mana)
		print("play card for target(s)", card_ui.targets)
		
func on_input(_enent: InputEvent) -> void:
	if played:
		return
	
	transition_requested.emit(self, CardState.State.BASE)
